<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('审读样本列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>样本名称：</label>
                            <input type="text" name="name"/>
                        </li>
                        <li>
                            <div class="">
                                <label class="">审读介质：</label>
                                <select name="medium" class="form-control noselect2 selectpicker" th:with="type=${@dict.getType('review_sample_medium')}">
                                    <option value="">--请选择审读介质--</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </div>
                        </li>
                        <li>
                            <label>出版单位：</label>
                            <input type="text" name="publisher"/>
                        </li>
                        <li>
                            <label>出版期刊：</label>
                            <input type="text" name="journalSuper"/>
                        </li>

                        <li class="select-time">
                            <label>缴送时间：</label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                   name="params[beginDeliveryTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                   name="params[endDeliveryTime]"/>
                        </li>
                        <li>
                            <label>出版标识：</label>
                            <input type="text" name="identification"/>
                        </li>

                        <li>
                            <label>审读结果：</label>
<!--                            <input type="text" name="ex1"/>-->
<!--                             name="params[beginDeliveryTime]"-->
                            <select name="params[result]" class="form-control noselect2 selectpicker" >
                                <option value="">--请选择--</option>
                                <option th:text="已审读"  th:value="已审读"></option>
                                <option th:text="未审读"  th:value="未审读"></option>
                            </select>
                        </li>

                        <li>
                            <label>创建人：</label>
                            <input type="text" name="createName"/>
                        </li>

                        <!--                            <li>-->
                        <!--                                <label>封面：</label>-->
                        <!--                                <input type="text" name="cover"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>说明：</label>-->
                        <!--                                <input type="text" name="sampleDesc"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>稿件id：</label>-->
                        <!--                                <input type="text" name="reviewId"/>-->
                        <!--                            </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!-- $.operate.add()     $.operate.addTab()        -->
            <a class="btn btn-success" onclick="$.operate.addTab()" >
                <i class="fa fa-plus"></i> 添加
            </a>
<!--            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"-->
<!--               shiro:hasPermission="publish:sample:edit">-->
<!--                <i class="fa fa-edit"></i> 修改-->
<!--            </a>-->
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="publish:sample:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = "";
    var removeFlag = "";
    var prefix = ctx + "publish/sample";

    // 获取数据字典数据
    var datas = [[${@dict.getType('review_sample_medium')}]];

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "审读样本",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'index',
                    align: 'center',
                    title: "序号",
                    formatter: function (value, row, index) {
                        var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                        return columnIndex + $.table.serialNumber(index);
                    }
                },
                // {
                //     field: 'createName',
                //     title: '创建人姓名'
                // },
                // {
                //     field: 'createBy',
                //     title: '创建人工号'
                // },
                {
                    //field: 'reviewId',
                    title: '审读结果',
                    formatter: function (value, row, index) {
                        // debugger
                        var _v = row.reviewId;
                        if(_v == 0||$.common.isEmpty(_v)){
                            return '未审读';
                        }else{
                            return '已审读';
                        }
                    }
                },
                {
                    field: 'name',
                    title: '样本名称'
                },
                {
                    field: 'publisher',
                    title: '出版单位',
                    sortable: true
                },
                {
                    // field: 'journalSuper',
                    title: '出版期刊',
                    formatter: function (value, row, index) {
                        return row.journalSuper + ':'+row.journalSub;
                    }
                },

                {
                    field: 'medium',
                    title: '审读介质',
                    // 格式化数据字典
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(datas, value);
                    }
                },
                // {
                //     field: 'journalSuper',
                //     title: '期刊主分类'
                // },
                // {
                //     field: 'journalSub',
                //     title: '期刊子分类'
                // },
                {
                    field: 'deliveryTime',
                    title: '缴送时间',
                    sortable: true
                },
                {
                    field: 'createName',
                    title: '创建人',
                    sortable: true
                },
                {
                    field: 'identification',
                    title: '出版标识'
                },
                // {
                //     field: 'reviewId',
                //     title: '稿件id'
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>